package com.guaju.yueshangLife.activity;

import android.databinding.DataBindingUtil;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.guaju.yueshangLife.R;
import com.guaju.yueshangLife.base.BaseActivity;
import com.guaju.yueshangLife.bean.MePermissionBean;
import com.guaju.yueshangLife.databinding.ActivityVipCenterBinding;
import com.guaju.yueshangLife.net.ApiEntity;
import com.guaju.yueshangLife.widget.mine.ItemMineCate;

import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.List;

public class VipCenterActivity extends BaseActivity {


    private ActivityVipCenterBinding binding;
    private List<MePermissionBean.DataBean> data;
    private ItemMineCate[] views;

    @Override
    protected void loadViewLayout() {
        binding = DataBindingUtil.setContentView(this,R.layout.activity_vip_center);

    }

    @Override
    protected void bindViews() {
        views = new ItemMineCate[]{binding.mine1, binding.mine2, binding.mine3, binding.mine4, binding.mine5, binding.mine6};

    }

    @Override
    protected void processLogic(Bundle savedInstanceState) {
        ApiEntity.mePermission();
    }

    @Override
    protected void setListener() {

    }


    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onMePermissionEvent(MePermissionBean bean) {
        if (bean==null||bean.getData()==null){
            return;
        }
        data = bean.getData();
        for (int i=0;i<6;i++){
            MePermissionBean.DataBean dataBean = data.get(i);
            String name = dataBean.getName();
            if (!TextUtils.isEmpty(name)){
                views[i].setText(name);
            }
        }
    }

}
